package com.lei.store;

import com.lei.store.impl.CardCommodityService;
import com.lei.store.impl.CouponCommodityService;
import com.lei.store.impl.GoodsCommodityService;

/**
 * @author: leiGer
 * @Date: 2022/01/14
 * @Time: 23:45
 */
public class StoreFactory {
    public ICommodity getCommodityService(Integer commodityType){
        if(null == commodityType){
            return null;
        }
        if (1 == commodityType){
            return new CouponCommodityService();
        }
        if (2 == commodityType){
            return new GoodsCommodityService();
        }
        if(3 == commodityType){
            return new CardCommodityService();
        }
        throw new RuntimeException("不存在的商品服务类型");
    }
}
